//
//  TabbleButton.m
//  groupProject
//
//  Created by mac on 15/12/18.
//  Copyright © 2015年 mac. All rights reserved.
//

#import "TabbleButton.h"

@implementation TabbleButton

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

- (instancetype) initWithFrame:(CGRect)frame {
    self = [super initWithFrame:frame];
    if (self)
    {
        
        [self setTitle:@"项目介绍" forState:UIControlStateNormal];
        [self.titleLabel setFont:[UIFont boldSystemFontOfSize:12]];
        //[self setBackgroundImage:[UIImage imageNamed:nil] forState:UIControlStateNormal];
        [self setImage:[UIImage imageNamed:@"user_head.png"] forState:UIControlStateNormal];
//        CGRect boundingRect=[self.titleLabel.text boundingRectWithSize:CGSizeMake(320,12) options:NSStringDrawingUsesLineFragmentOrigin attributes:@{NSFontAttributeName:[UIFont systemFontOfSize:12]} context:nil];
    }
    return self;
}


- (CGRect)backgroundRectForBounds:(CGRect)bounds {
    return bounds;
}
- (CGRect)contentRectForBounds:(CGRect)bounds {
    //return CGRectMake(bounds.origin.x + bounds.size.width * 0.1, bounds.origin.y+bounds.size.height* 0.1, bounds.size.width * 0.8 , bounds.size.height * 0.8) ;
    return bounds;
}
- (CGRect)titleRectForContentRect:(CGRect)contentRect {
    return CGRectMake(0, contentRect.size.height*0.7, contentRect.size.width, contentRect.size.height*0.3);
}
- (CGRect)imageRectForContentRect:(CGRect)contentRect {
    CGFloat minwidth = contentRect.size.width;
    return CGRectMake(contentRect.size.width/2.0 - minwidth / 2.0, 0, minwidth, minwidth);
}

@end
